package com.xbongbong.pro.aiassistant.help;

import com.xbongbong.pro.domain.entity.AiAssistantEntity;
import com.xbongbong.pro.enums.SaasMarkEnum;
import com.xbongbong.pro.enums.smartsettings.enums.SmartActionTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;

/**
 * @description: 智能助手服务帮助类
 * @Author: hongxiao
 * @date: 2019-08-13 10:42
 * @since v1.0
 */
@Component
public class SsServiceHelp {

    /**
     * 获取业务分类后的智能助手
     *
     * @param smartList 智能助手列表
     * @param smsSmartList 短信类型的智能助手
     * @param workReportSmartList 工作报告类型的智能助手
     * @param saasSmartList saas智能助手（不包括：短信类型、工作报告类型）
     * @param paasSmartList paas智能助手（不包括：短信类型）
     * @return
     * @throws
     * @author hongxiao
     * @date 2019-08-13 10:49
     * @since v1.0
     * @version v1.0
     */
    public void getSmartSettingsForCategory(List<AiAssistantEntity> smartList, List<AiAssistantEntity> smsSmartList,
                                        List<AiAssistantEntity> workReportSmartList, List<AiAssistantEntity> saasSmartList,
                                        List<AiAssistantEntity> paasSmartList) {

        for (AiAssistantEntity entity : smartList) {
            // 短信类智能助手
            if (Objects.equals(SmartActionTypeEnum.SMS.getCode(), entity.getAction())) {
                smsSmartList.add(entity);
            } else if (Objects.equals(SaasMarkEnum.SAAS.getCode(), entity.getSaasMark())) {
                // 工作报告类型智能助手
                if (Objects.equals(XbbRefTypeEnum.WORK_REPORT.getCode(), entity.getBusinessType())) {
                    workReportSmartList.add(entity);
                } else {
                    // saas类型智能助手
                    saasSmartList.add(entity);
                }
            } else if (Objects.equals(SaasMarkEnum.PAAS.getCode(), entity.getSaasMark())) {
                // paas类型智能助手
                paasSmartList.add(entity);
            }
        }
    }
}
